package com.wilson.treeviewer.mock;

import java.util.ArrayList;
import java.util.List;

import com.wilson.treeviewer.model.User;
import com.wilson.treeviewer.model.UserNode;
import com.wilson.treeviewer.model.UserUtil;

public class SampleUsers {

    public static List<UserNode> createNodes() {
        List<User> users = createUsers();
        List<UserNode> nodes = UserUtil.createNodes(users);
        return nodes;
    }

    public static List<User> createUsers() {
        List<User> users = new ArrayList<>();
        users.add(newUser("BOSS", "no manager"));

        users.add(newUser("CEO", "BOSS"));
        users.add(newUser("CTO", "BOSS"));
        users.add(newUser("CFO", "BOSS"));

        users.add(newUser("user1", "CEO"));
        users.add(newUser("user2", "CEO"));

        users.add(newUser("Dev Manager", "CTO"));
        users.add(newUser("QA Manager", "CTO"));

        users.add(newUser("dev1", "Dev Manager"));
        users.add(newUser("dev2", "Dev Manager"));

        users.add(newUser("qa1", "QA Manager"));
        users.add(newUser("qa2", "QA Manager"));

        return users;
    }

    private static User newUser(String id, String managerId) {
        User user = new User();
        user.setId(id);
        user.setUsername(id);
        user.setManagerId(managerId);
        return user;
    }
}
